{"ast":null,"code":"export const getOtherUserForNotMultiChat = (store, membershipList) => {\n  if (membershipList.items.length > 0) {\n    for (let i = 0; i < membershipList.items.length; i++) {\n      if (membershipList.items[i].usersListItem.id !== store.getProfile().id) {\n        return membershipList.items[i].usersListItem;\n      }\n    }\n  }\n  return store.getProfile();\n};\nexport const isOwnerMultiChat = (membershipCollection, user) => {\n  return !!(membershipCollection.items[0] && membershipCollection.items[0].usersListItem.id === user.id);\n};\nexport const getCurrentMembership = (membershipCollection, user) => {\n  let membership = {};\n  membershipCollection.items.forEach(item => {\n    if (item.usersListItem.id === user.id) {\n      membership = {\n        ...item\n      };\n    }\n  });\n  return membership;\n};","map":{"version":3,"names":["getOtherUserForNotMultiChat","store","membershipList","items","length","i","usersListItem","id","getProfile","isOwnerMultiChat","membershipCollection","user","getCurrentMembership","membership","forEach","item"],"sources":["/data/messenger.client/src/utils/Membership.ts"],"sourcesContent":["import {UserListItem} from \"../models/response/UserListItem\";\nimport Store from \"../store/store\";\nimport {MembershipListResponse} from \"../models/response/MembershipListResponse\";\nimport {MembershipListItem} from \"../models/response/MembershipListItem\";\n\nexport const getOtherUserForNotMultiChat = (store: Store, membershipList: MembershipListResponse): UserListItem => {\n    if (membershipList.items.length > 0) {\n        for (let  i = 0; i < membershipList.items.length; i++) {\n            if (membershipList.items[i].usersListItem.id !== store.getProfile().id) {\n                return membershipList.items[i].usersListItem;\n            }\n        }\n    }\n    return store.getProfile();\n}\n\nexport const isOwnerMultiChat = (membershipCollection: MembershipListResponse, user: UserListItem): boolean => {\n    return !!(membershipCollection.items[0] && membershipCollection.items[0].usersListItem.id === user.id);\n}\n\nexport const getCurrentMembership = (membershipCollection: MembershipListResponse, user: UserListItem): MembershipListItem => {\n    let membership = {} as MembershipListItem;\n\n    membershipCollection.items.forEach((item) => {\n        if (item.usersListItem.id === user.id) {\n            membership = {...item};\n        }\n    });\n\n    return membership;\n}"],"mappings":"AAKA,OAAO,MAAMA,2BAA2B,GAAG,CAACC,KAAY,EAAEC,cAAsC,KAAmB;EAC/G,IAAIA,cAAc,CAACC,KAAK,CAACC,MAAM,GAAG,CAAC,EAAE;IACjC,KAAK,IAAKC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,cAAc,CAACC,KAAK,CAACC,MAAM,EAAEC,CAAC,EAAE,EAAE;MACnD,IAAIH,cAAc,CAACC,KAAK,CAACE,CAAC,CAAC,CAACC,aAAa,CAACC,EAAE,KAAKN,KAAK,CAACO,UAAU,EAAE,CAACD,EAAE,EAAE;QACpE,OAAOL,cAAc,CAACC,KAAK,CAACE,CAAC,CAAC,CAACC,aAAa;MAChD;IACJ;EACJ;EACA,OAAOL,KAAK,CAACO,UAAU,EAAE;AAC7B,CAAC;AAED,OAAO,MAAMC,gBAAgB,GAAG,CAACC,oBAA4C,EAAEC,IAAkB,KAAc;EAC3G,OAAO,CAAC,EAAED,oBAAoB,CAACP,KAAK,CAAC,CAAC,CAAC,IAAIO,oBAAoB,CAACP,KAAK,CAAC,CAAC,CAAC,CAACG,aAAa,CAACC,EAAE,KAAKI,IAAI,CAACJ,EAAE,CAAC;AAC1G,CAAC;AAED,OAAO,MAAMK,oBAAoB,GAAG,CAACF,oBAA4C,EAAEC,IAAkB,KAAyB;EAC1H,IAAIE,UAAU,GAAG,CAAC,CAAuB;EAEzCH,oBAAoB,CAACP,KAAK,CAACW,OAAO,CAAEC,IAAI,IAAK;IACzC,IAAIA,IAAI,CAACT,aAAa,CAACC,EAAE,KAAKI,IAAI,CAACJ,EAAE,EAAE;MACnCM,UAAU,GAAG;QAAC,GAAGE;MAAI,CAAC;IAC1B;EACJ,CAAC,CAAC;EAEF,OAAOF,UAAU;AACrB,CAAC"},"metadata":{},"sourceType":"module"}